@using SSRSCore.Feeds.Models
@using SSRSCore.ResourceManagement
@using SSRSCore.ContentManagement

@inject IResourceManager ResourceManager
@inject IContentManager ContentManager

@{
    ContentItem contentItem = Model.ContentItem;
    var feedMetadata = await ContentManager.PopulateAspectAsync<FeedMetadata>(contentItem);
    ResourceManager.RegisterLink(new LinkEntry
    {
        Rel = "alternate",
        Type = "application/rss+xml",
        Title = contentItem.DisplayText,
        Href = String.IsNullOrWhiteSpace(feedMetadata.FeedProxyUrl)
            ? Url.Action("Index", "Feed", new { area = "SSRSCore.Feeds", ContentItemId = contentItem.ContentItemId }, Context.Request.Scheme)
            : feedMetadata.FeedProxyUrl
    });
}